1. Field of the Invention
The present invention relates to an image processing apparatus, an electronic medium, and an image processing method for computing a minimum bounding rectangles of a figure in a processing target image in each direction for example.
2. Description of the Related Art
In recognition of characters printed on a number tag in images taken by a camera for example, a character line on the number tag is not always aligned in a horizontal direction.
If this happens, the character part of the number tag does not match with dictionary data for character recognition, and thus it is necessary in general to perform processing for cutting out an image of the character part of the number tag and estimating the direction of the characters.
For example, the character line is extracted from the image and the direction in which the length of the line is maximum is assumed to be the estimated direction of the line.
The candidate of the character row in each direction can be estimated using a minimum bounding rectangle in each direction of the character part image.
As a calculating method of a minimum bounding rectangles, the method described below is widely known.
For example, the maximum values and the minimum values of X coordinates and Y coordinates are computed with respect to each of pixels on a figure or points on a contour of a figure, and they are taken as the coordinates of an upper and lower ends and a left and right ends, thereby computing a minimum bounding rectangles of the figure.
Note that a horizontal direction will be described as an X-axis direction, a vertical direction as a Y-axis direction, a coordinate in the X-axis direction as an X coordinate, and a coordinate in the Y-axis direction as a Y coordinate (these expressions will be used hereinafter).
Another widely known method to compute the minimum bounding rectangles is to compute integrals of the target image or binarization result of the target image in the X-axis direction and the Y-axis direction, and to compute the minimum and maximum coordinate on which the integrals is larger than of or equal with a predefined thresholds.
Furthermore, as methods for calculating a minimum bounding rectangle in each direction, there are several variations of the above-described methods.
In the first example of such a method, the coordinates for each pixel on the figure is transformed to the coordinates in the coordinate system of which one of the axis is parallel to the direction of interest, and the minimum bounding rectangle is determined by computing minimum and maximum of the coordinate transformed above. (hereinafter this method will be denoted “method A”).
In the second example of such a method, contour points of a figure are extracted, and a minimum bounding rectangle in a direction of interest is computed as the maximum values and the minimum values of coordinates transformed by the transformation described for method A, for each contour point (hereinafter this method will be denoted “method B”).
In the third example of such a method, the image to be processed or an image obtained by binarizing the image to be processed is integrated in a direction of interest and in a direction perpendicular to the direction of interest, and the coordinates of an upper and lower ends and a left and right ends are obtained by taking the minimum values and the maximum values of coordinates for which integrated values are equal to or larger than predefined thresholds (hereinafter this method will be denoted “method C”).
In the fourth example of such a method, the image is rotated so that a straight line directed in a direction of interest is a horizontal direction or a vertical direction on the image to be processed, and a minimum bounding rectangle is calculated on the rotated image (hereinafter this method will be denoted “method D”).
Furthermore, a typical method to calculate the projection of a figure in each direction is to project coordinates of a pixel of interest to a coordinate axis directed in a direction of interest for each pixel on a figure, and to calculate a histogram of the projected coordinates.
As a method to estimate the direction of a character row, a method, with which a projection of the image is calculated in each direction, and the direction in which the calculated projection changes most rapidly is assumed as the direction of the character row, is known (see, for example, JP-A 57-052971 (KOKAI)).